<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="${ctxPath}/assets/expand/images/favicon.ico" rel="icon">
    <title>${constants.getSystemName()}</title>
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="${ctxPath}/assets/css/font-awesome.min.css"/>

    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-fonts.css"/>
    <link rel="stylesheet" href="${ctxPath}/assets/css/ace.min.css"
          id="main-ace-style"/>

    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-skins.min.css"/>
    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-rtl.min.css"/>

    <link rel="stylesheet" href="${ctxPath}/assets/css/ui.jqgrid.css"/>

    <link rel="stylesheet" href="${ctxPath}/assets/css/jquery-ui.min.css"/>
    <link rel="stylesheet" href="${ctxPath}/assets/css/datepicker.css"/>

    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-part2.min.css"/>

    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-skins.min.css"/>
    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-rtl.min.css"/>


    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-ie.min.css"/>

    <link rel="stylesheet" href="${ctxPath}/assets/css/ace-ie.min.css"/>
	<!-- ace scripts -->
	<script type="text/javascript" src="${ctxPath}/assets/js/jquery.min.js"></script>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
    	/* div#mainContent
		{
		 height:expression(window.screen.height - 40 );
		} */
    </style>
    <script type="text/javascript">
   		function changeFrameHeight(that){
   	        //电脑屏幕高度-iframe上面其他组件的高度
   	        $(that).height(document.documentElement.clientHeight - 150);
   	    }
   		function turnToIndex(indexUrl){
   			if(!indexUrl || indexUrl == '' || indexUrl=='#'){
   				return ;
   			}
   			$('#mainIframe').attr('src', indexUrl);
   			return ;
   		}
    </script>
</head>
<body class="no-skin theme-white">

	<!-- 头部 -->
	<div id="navbar" class="navbar navbar-default">
	    <script type="text/javascript">
	        try {
	            ace.settings.check('navbar', 'fixed')
	        } catch (e) {
	        }
	
	
	    </script>
	
	    <div class="navbar-container" id="navbar-container">
	        <!-- #section:basics/sidebar.mobile.toggle -->
	        <button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler">
	            <span class="sr-only">Toggle sidebar</span>
	
	
	        </button>
	
	        <!-- /section:basics/sidebar.mobile.toggle -->
	        <div class="navbar-header pull-left">
	            <!-- #section:basics/navbar.layout.brand -->
	            <a href="#" class="navbar-brand">
	                <small> 计算机病毒密码检测分析系统V1.0
	                </small>
	            </a>
	
	
	        </div>
	
	        <!-- #section:basics/navbar.dropdown -->
	        <div class="navbar-buttons navbar-header pull-right" role="navigation">
	            <ul class="nav ace-nav" >
					
	
	                <!-- #section:basics/navbar.user_menu -->
	                <li class="light-blue" >
	                    <a data-toggle="dropdown" href="#" class="dropdown-toggle">
	                        <span class="">欢迎您：${name!"用户"}
							</span>
							<i class="ace-icon fa fa-caret-down"></i>
	                    </a>
	                    <ul id="topDropdownMenu"
	                        class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
	                        <li>
	                            <a href="#" id="setPsw">
	                                <i class="ace-icon fa fa-key"></i> 修改密码
	                            </a>
	                        </li>
	                        <li>
	                            <a href="#" id="btnLogout">
	                                <i class="ace-icon fa fa-power-off"></i> ${translate.get("MENU_LOGOUT","退出")}
	                            </a>
	                        </li>
	
	                    </ul>
	                </li>
	                <!-- /section:basics/navbar.user_menu -->
	            </ul>
	        </div>
	
	        <!-- /section:basics/navbar.dropdown -->
	    </div>
	    <!-- /.navbar-container -->
	</div>
	
	<div class="main-container" id="main-container">
	    <script type="text/javascript">
	        try {
	            ace.settings.check('main-container', 'fixed')
	        } catch (e) {
	        }
	    </script>
	
	    <!-- #section:basics/sidebar -->
	    <div id="sidebar" class="sidebar responsive">
	        <script type="text/javascript">
	            try {
	                ace.settings.check('sidebar', 'fixed');
	               
	            } catch (e) {
	            }
	        </script>
	        <!--菜单树-->
	        <ul id="menulist" class="nav nav-list">
	        	@for(item in layuiAppIndexMenus){
		            @for(menu in item.layuiIndexMenuTreeNodes) {
		            	<li class="">
			                @if(objectUtil.isEmpty(menu.children)){
			                	@if(itemLP.first && menuLP.first){
				                <a id="firstPageAction" class="sigleHref" data-url='${menu.layuiPath}' lay-href='${menu.layuiPath}'>
				                    <i class='${menu.layuiIcon}'></i>
				                    <span class='menu-text'>${menu.menuName}</span>
				                    <b class='arrow'></b>
				                </a>
				                @}else{
	                            <a data-url='${menu.layuiPath}' class="sigleHref" lay-href='${menu.layuiPath}'>
				                    <i class='${menu.layuiIcon}'></i>
				                    
				                    <span class='menu-text'>${menu.menuName}</span>
				                    <b class='arrow'></b>
				                </a>
	                            @}
			                @}else{
			                <a href='#' class='dropdown-toggle menuHref' data-url='${menu.layuiPath}'>
			                    <i class='${menu.layuiIcon}'></i>
			                    <span class='menu-text'>${menu.menuName}</span>
			                    <b class='arrow fa fa-angle-down'></b>
			                </a>
			                <ul class='submenu'>
			                    @for(subMenu in menu.children){
			                    	
			                    	
			                    	<li class=''>
			                    		<a data-url='${subMenu.layuiPath}' class="sigleHref" >
											<i class='menu-icon fa fa-caret-right'>
											</i>
											
											${subMenu.menuName}
											
										</a>
										<b class='arrow'>
										</b>
			                    	</li>
			                    @}
			                </ul>
			                @}
			            </li>
			       @}
		        @}
	        </ul>
	 		
	        <!-- /.nav-list -->
	
	        <!-- #section:basics/sidebar.layout.minimize -->
	        <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
	            <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left"
	               data-icon2="ace-icon fa fa-angle-double-right"></i>
	        </div>
	
	        <!-- /section:basics/sidebar.layout.minimize -->
	        <script type="text/javascript">
	            try {
	                ace.settings.check('sidebar', 'collapsed')
	            } catch (e) {
	            }
	        </script>
	    </div>
	
	    <!-- /section:basics/sidebar -->
	    <div class="main-content" id="mainContent" style="height:100%">
	        <!-- #section:basics/content.breadcrumbs -->
	        <div class="breadcrumbs" id="breadcrumbs">
	            <script type="text/javascript">
	                try {
	                    ace.settings.check('breadcrumbs', 'fixed')
	                } catch (e) {
	                }
	            </script>
	
	            <ul class="breadcrumb">
	                <li>
	                    <i class="ace-icon fa fa-arrow-left"></i>
	                   <!--  <a href="#" onclick="turnToIndex('/view/home/index');return false;">首页</a>&nbsp;<span id="uname"></span> -->
	                    <a href="#" onclick="window.history.go(-1);">返回</a>&nbsp;<span id="uname"></span>
	                </li>
	            </ul>
	            <!-- /.breadcrumb -->
	
	            <!-- /section:basics/content.searchbox -->
	        </div>
	
	        <!-- /section:basics/content.breadcrumbs -->
	        <div class="page-content" style="height:100%">
				<iframe id="mainIframe" class="admin-iframe" onload="changeFrameHeight(this)" src=""  frameborder="0"></iframe>
	            <!-- /section:settings.box -->
	            <!-- <div class="page-content-area layui-body"> -->
	                <!-- ajax content goes here -->
	            </div>
	            <!-- /.page-content-area -->
	        </div>
	        <!-- /.page-content -->
	    </div>
	    <!-- /.main-content -->
	
	    <div class="footer">
	        <div class="footer-inner">
	            <!-- #section:basics/footer -->
	            <div class="footer-content">
							<span class="bigger-120">
								<span class="blue bolder">copyright © 2020 <a href="http://www.scctc.org.cn/" target="_blank">国家密码管理局商用密码检测中心</a> all rights reserved.</span>
							</span>
	
	            </div>
	
	            <!-- /section:basics/footer -->
	        </div>
	    </div>
	
	    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
	        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
	    </a>
	</div>


    <!-- 主体部分 -->

</div>

<!-- 加载动画 -->
@include("/layout/loading.html"){}

	<!-- js全局变量 -->
	<script type="text/javascript">
	    var Feng = {
	        ctxPath: "${ctxPath}",
	        version: '${constants.getReleaseVersion()}',
	        wsUrl: '${wsUrl}'
	    };
	</script>
	
	<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
	<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script>
    var wsInst = null;

    layui.use(['layer', 'element', 'admin', 'index', 'HttpRequest', 'ws', 'notice', 'i18n'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var admin = layui.admin;
        var index = layui.index;
        var HttpRequest = layui.HttpRequest;
        var ws = layui.ws;
        var notice = layui.notice;
        var i18n = layui.i18n;
        // admin.changeTheme("theme-white");
        
       
        
        //获取支持的语言列表
        let languageTypes = i18n.getLanguageTypes();
        for (var i = 0; i < languageTypes.length; i++) {
            var code = languageTypes[i].code;
            var description = languageTypes[i].name;
            $("#languageDiv").append('<dd lay-unselect><a id="tran-' + code + '" href="javascript:;">' + description + '</a></dd>');

            //设置监听事件，设置点击按钮切换当前系统语言
            (function (code) {
                $('#tran-' + code).click(function () {
                    i18n.changeUserTranslation(code);
                });
            })(code);
        }

        // 记载并缓存翻译的字典
        i18n.loadAndCacheTranslation();

        // 默认加载主页
        index.loadHome({
            menuPath: $("#firstPageAction").attr('lay-href'),
            menuName: '<i class="layui-icon layui-icon-home"></i>'
            
              
        });

        // 修改密码点击事件
        $('#setPsw').click(function () {
            admin.open({
                id: 'pswForm',
                type: 2,
                title: i18n.translate('TITLE_CHANGE_PASSWORD', '修改密码'),
                shade: 0,
                content: '${ctxPath}/view/changePassword'
            });
        });

        // 退出登录点击事件
        $('#btnLogout').click(function () {
            var request = new HttpRequest(Feng.ctxPath + "/logout", 'post', function (data) {
                Feng.success("退出成功!");
                window.location.href = Feng.ctxPath + "/";
            }, function (data) {
                layer.msg("退出失败！" + data.message, {icon: 5, anim: 6});
            });
            request.start();
        });
        wsInst = ws.render({
            wsUrl: Feng.wsUrl, //WebSocket的地址
            connectErr: function (event) {
                console.log(event)
                //如果不支持websocket 回调
            },
            onWsError: function (event) {
                //发生连接错误回调
            },
            onWsOpen: function (event) {
                //连接成功回调
                console.log("Socket 已打开");
                wsInst.send("消息发送测试(From Client)");
            },
            onWsMessage: function (event) {
                //服务器发送消息回调
                let data = event.data;
                try {
                    let msg = JSON.parse(data)
                    notice.info({
                        title: '[' + msg.businessTypeValue + ']' + msg.messageTitle,
                        message: msg.messageContent,
                        timeout: false
                    });
                    $('#messageDot').show();
                } catch (e) {
                }
            },
            onWsClose: function (event) {
                //关闭连接回调
            },

            wsSend: function (event) {
                //发送成功后的回调
            },

        })
    });

    window.unload = function () {
        if (wsInst) {
            wsInst.close();
        }
 
    };
    
</script>
	<!-- ace settings handler -->
    <script type="text/javascript" src="${ctxPath}/assets/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${ctxPath}/assets/js/jquery-ui.min.js"></script>
    <script src="${ctxPath}/assets/js/ace.min.js" type="text/javascript"></script>
    <script src="${ctxPath}/assets/js/ace-elements.min.js" type="text/javascript"></script>
    <script src="${ctxPath}/assets/js/ace-extra.min.js" type="text/javascript"></script>
    <script src="${ctxPath}/assets/js/pageload.js" type="text/javascript"></script>
</body>
<script type="text/javascript">
        $(document).ready(function(){
        	var dataUrl=$('#mainIframe').attr('src');
        	var biaoQian=$("a[data-url$='/view/sample']");
        	var biaoQian1=$("a[data-url$=]");
        	var parent=biaoQian.parent();
        
        
        
        
            var url = document.location.href;            
            var index1 = url.lastIndexOf('/');
            var page_name = url.substring(index1 + 1, url.length);
         
            var a_l = $('a');
            a_l.each(function () {
                var that = $(this);
                var url2 = that.attr('href');
                
                var index2 = url2.lastIndexOf('/');
                var page_name2 = url2.substring(index2 + 1, url2.length);
                if (page_name == page_name2) {
                    $(this).parent().addClass('active');
                    $(this).parent().parent().parent().addClass('open');
                }
            });          
        });
    </script>
</html>
